package com.example.graduatetest.activitys;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProviders;

import android.content.Intent;
import android.os.Bundle;

import com.example.graduatetest.R;
import com.example.graduatetest.bean.Classes;
import com.example.graduatetest.bean.Teacher;
import com.example.graduatetest.databinding.ActivityTeacherPersonBinding;
import com.example.graduatetest.view.model.SendCardViewModel;
import com.example.graduatetest.view.model.TeacherPersonViewModel;

public class TeacherPersonActivity extends AppCompatActivity {
    private ActivityTeacherPersonBinding binding;
    private TeacherPersonViewModel personViewModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_teacher_person);

        //隐藏ActionBar
        if(getSupportActionBar() != null){
            ActionBar actionBar = getSupportActionBar();
            actionBar.hide();
        }
        binding = DataBindingUtil.setContentView(this,R.layout.activity_teacher_person);

        //接受Intent传来的数据
        Intent intent = getIntent();
        String teacher_id = intent.getStringExtra("teacher_id");

        //LiveData
        personViewModel = ViewModelProviders.of(this).get(TeacherPersonViewModel.class);
        binding.setTeacherPersonViewModel(personViewModel);
        binding.setLifecycleOwner(this);
        personViewModel.init(this,binding,teacher_id);
    }
}

